package com.hk.shop.dao.impl;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.hk.shop.base.dao.BaseDaoImpl;
import com.hk.shop.dao.AdminDao;
import com.hk.shop.model.Admin;

@Repository("adminDao")
public class AdminDaoImpl extends BaseDaoImpl<Admin, Integer> implements AdminDao{

	@Override
	public Admin findByAdminnameAndPassword(String username, String password) {
		String hql = "from Admin a where a.username = ? and a.password = ?";
		Query query = this.getCurrentSession().createQuery(hql);
		query.setParameter(0, username);
		query.setParameter(1, password);
		return (Admin)query.uniqueResult(); 
	}

}
